<%@ page language="java" import="com.engine.kq.cmd.report.GetKQReportCmd" pageEncoding="UTF-8" %>
<%@ page import="net.sf.json.JSONArray" %>
<%@ page import="net.sf.json.JSONObject" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>

<%
    Map<String, JSONObject> all = new HashMap<String, net.sf.json.JSONObject>();
    // 从系统考勤报表接口 获取数据 因存在页数问题 用遍历的方式获取所有人数据再放到map里 供后面使用
    for (int i = 1; i <= 20; i++) {
        Map<String, Object> params = new HashMap<String, Object>();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("pageIndex",i);
        jsonObject.put("typeselect",3);
        jsonObject.put("viewScope","0");
        jsonObject.put("status","8");
        jsonObject.put("isNoAccount","0");
        jsonObject.put("attendanceSerial","");
        params.put("data",jsonObject.toString());
        params.put("reportType", "month");
        User user = new User(1);
        GetKQReportCmd gq = new GetKQReportCmd(params, user);
        Map<String, Object> map = gq.execute(null);

        if ((map.get("datas") + "").length() == 2) {
            i = 101;
        } else {
           JSONObject json = JSONObject.fromObject(map);
            JSONArray jsonarray = JSONArray.fromObject(json.get("datas").toString());
            for (int j = 0; j < jsonarray.size(); j++) {
                all.put(jsonarray.getJSONObject(j).get("resourceId") + "", jsonarray.getJSONObject(j));
            }
        }
    }

    out.print( "all="+all.toString() );
%>
